﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Kugar.Core.BaseStruct;
using Kugar.Tool.DataSync.Client.BLL;
using Kugar.Tool.DataSync.ClientPlugin;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Kugar.Tool.DataSync.Client
{
    public class HomeController : ApiController
    {
        public async Task<ResultReturn> Update(string dataType)
        {
            var content = await Request.Content.ReadAsStringAsync();

            var json = JsonConvert.DeserializeObject<JObject>(content);

            var ret=WebBLL.Plugin.TriggerImport(dataType, json);

            return ret;
        }
    }
}
